package com.dsj.estore.util;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 * 数据库连接工具类
 * 得到数据库连接对象
 */
public class DBContnection {
    private String dbDriver = "com.mysql.cj.jdbc.Driver";
    private String url = "jdbc:mysql://localhost:3306/e13?useSSl=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8";
    public Connection connection = null;

    public DBContnection() {
        try {
            Class.forName(dbDriver).newInstance();
            connection = DriverManager.getConnection(url, "root", "123456");
        } catch (Exception e) {
            System.out.println("数据库加载失败");;
        }
    }
}
